<template>
  <div style="width:100%;height:3%;margin:0px;padding:0px;background: #A52A2A;">
      <div style="float:left">Redis DeskTop {{userName}}</div><div style="float:right">{{data}}</div>
  </div>
</template>
<script>

import {login,logout} from '@/conf/api0'
export default {

  data() {
    return {
      userName: 'P',
      data: new Date()
    }
  },
  mounted() {
    var _this = this;
    this.timer = setInterval(function() {
      _this.data = new Date();
    },1000);
    this.getVersion();
    // this.getVersion2();
  },
  beforeDestroy() {
    if(this.timer) {
      clearInterval(this.timer);
    }
  },
  methods: {

    getVersion() {
        login().then(res=> {
          this.userName = res.data;
          console.log(res);
        });
        logout().then(res=> {
          this.userName = this.userName+res.data;
          console.log(res);
        });
    }
  }
}

</script>
